package com.example.r2022913.controller.WxController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.r2022913.common.ApiRestResponse;
import com.example.r2022913.service.WxService.WcService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("wx/wc")
@Api(tags = "wx小程序服务  wcController")
@Slf4j
public class WcController {
    @Autowired
    WcService wcService;

    //TODO 为列表增加经纬度列 后台能够对其进行添加

    @ApiOperation(value = "后台查看厕所列表")
    @GetMapping("/page")
    public ApiRestResponse wcList(@RequestParam(defaultValue = "1") Integer pageNum,
                                            @RequestParam(defaultValue = "10") Integer pageSize,
                                            @RequestParam(defaultValue = "") Map<String, Object> params){
        IPage page = wcService.wcList(pageNum,pageSize,params);
        return ApiRestResponse.success(page);
    }

//    @ApiOperation(value = "后台删除厕所")
//    @DeleteMapping("/delete/{id}")
//    public ApiRestResponse wcDelete(@PathVariable Integer id){
//        log.info("传过来的id是===》{}",id);
//
//        wcService.delete(id);
//        return ApiRestResponse.success();
//    }
//
//
//    @ApiOperation(value = "后台添加厕所")
//    @PostMapping("/add")
//    public ApiRestResponse wcAdd(@RequestBody WcEntity wcEntity){
//        wcService.saveAndUpdate(wcEntity);
//        return ApiRestResponse.success();
//    }
}
